<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/vue.js"></script>
    <script src="js/axios.min.js"></script>
    <style>
        table{
            width: 400px;
            border-collapse: collapse;
        }
        th,td{
            border: 1px solid #ccc;
        }
    </style>
</head>
<body>
    <div id="app">
        <input type="text" v-model="school">
        <button @click="search">搜索</button>
        <br> <br>

        <table>
            <thead>
                <tr>
                    <th>name</th>
                    <th>高亮字段</th>
                </tr>
            </thead>
            <tbody>
                <tr v-for="item in students" :key="item.id">
                    <td>{{ item.name }}</td>
                    <td v-html="item.highlightField"></td>
                </tr>
            </tbody>
        </table>
    </div>

    <script>
        new Vue({
            el: ' #app',
            data:{
                school: '',
                students: []
            },
            methods:{
                search(){
                    axios.get(`/doc/highlight/${this.school}`).then(res => {
                        console.log(res)
                        this.students = res.data
                    })
                }
            }
        })
    </script>
</body>
</html>